package com.cskaoyan.dbutils;

import com.cskaoyan.connectionpool.DruidUtils;
import org.apache.commons.dbutils.QueryRunner;

import java.sql.Connection;
import java.sql.SQLException;

/**
 * 创建日期: 2022/04/23 10:30
 *
 * @author ciggar
 */
public class DBUtilsDemo {

    public static void main(String[] args) throws SQLException {

        // 无参构造
//        QueryRunner queryRunner1 = new QueryRunner();

        // 有参构造
        QueryRunner queryRunner2 = new QueryRunner(DruidUtils.getDataSource());


        //  获取Connection对象
//        Connection connection = DruidUtils.getConnection();


        // 包装SQL语句，发送给MySQL服务器
        int affectedRows = queryRunner2.update("insert into account values (?,?,?)",11,"西门庆",2000);

        System.out.println(affectedRows);


    }
}
